package mo.offer_special;

import mo.common.TreeNode;

import java.util.ArrayDeque;
import java.util.Queue;

public class L045 {

    public int findBottomLeftValue(TreeNode root) {
        int res = 0;
        Queue<TreeNode> queue = new ArrayDeque<>();
        queue.add(root);
        while (!queue.isEmpty()) {
            TreeNode node = queue.poll();
            if (node.right != null) {
                queue.add(node.right);
            }
            if (node.left != null) {
                queue.add(node.left);
            }
            res = node.val;
        }
        return res;
    }



}
